/*
 * @Author: chen haoxuan
 * @Date: 2021-05-25 19:43:39
 * @LastEditTime: 2021-05-26 21:04:38
 */
#include <iostream>
#include<string>
using namespace std;
class Student
{
public:
    Student(int num, string name, char s,int sco) : num(num), name(name), sex(s),score(sco) {}
    friend ostream &operator<<(ostream &output, Student &s);
    int num;
    string name;
    char sex;
    int score;
};
class Teacher
{
public:
    Teacher(Student &s);
    friend ostream &operator<<(ostream &output, Teacher &t);
    int num;
    string name;
    char sex;
};
ostream &operator<<(ostream &output, Student &s)
{
    output << "Student:"
           << "\n"
           << "num: " << s.num << " name: " << s.name << " sex: " << s.sex <<" score: "<<s.score<<endl;
    return output;
}
ostream &operator<<(ostream &output, Teacher &t)
{
    output << "Teacher:"
           << "\n"
           << "num: " << t.num << " name: " << t.name << " sex: " << t.sex << endl;
    return output;
}
Teacher::Teacher(Student &s)
{
    num=s.num;
    name=s.name;
    sex=s.sex;
}
int main()
{
    Student s1(1,"Jack",'M',89);
    cout<<s1;
    Teacher t1(s1);
    cout<<t1;
    system("pause");
    return 0;
}